package com.spring.bean.lifecycle;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
public class LifeCyele {
    private String content;

    public void setContent(String content) {
        this.content = content;
    }

           @PostConstruct
        public void init() {
            System.out.println("Bean 初始化完成");
            // 在这里添加初始化后的监控逻辑
        }

           @PreDestroy
        public void destroy() {
            System.out.println("Bean 即将被销毁");
            // 在这里添加销毁前的监控逻辑
        }

        // 其他业务方法
        public void doSomething() {
            System.out.println("执行业务逻辑");
    }

}
